package com.xyzk.diagnose.entity;

public class Can {
	private int mode;//CAN
	private int baud;//波特率
	private byte [] addr;//请求、接收ID
	private int sendid;
	private int recvid;

	public Can(int mode, int baud, byte[] addr){
		this.mode = mode;
		this.baud = baud;
		this.addr = addr;
		if(addr.length == 8) //正常
		{
			this.sendid = ((addr[0]&0xFF) << 8) + (addr[1]&0xFF);
			this.recvid = ((addr[2]&0xFF) << 8) + (addr[3]&0xFF);
		}
		else
		{
			this.sendid = ((addr[0]&0xFF) << 24) + ((addr[1]&0xFF) << 16) + ((addr[2]&0xFF) << 8) + (addr[3]&0xFF);
			this.recvid = ((addr[4]&0xFF) << 24) + ((addr[5]&0xFF) << 16) + ((addr[6]&0xFF) << 8) + (addr[7]&0xFF);
		}
	}
	public int getSendid()
	{
		return this.sendid;
	}
	public int getRecvid()
	{
		return this.recvid;
	}
	public int getMode() {
		return mode;
	}

	public void setMode(int mode) {
		this.mode = mode;
	}

	public int getBaud() {
		return baud;
	}

	public void setBaud(int baud) {
		this.baud = baud;
	}

	public byte[] getAddr() {
		return addr;
	}

	public void setAddr(byte[] addr) {
		this.addr = addr;
	}

}
